Add some (safety) code for a consistent behaviour of queue pointers.
authoroliskoli <oliskoli>
Tue, 20 Feb 2007 21:02:10 +0000 (21:02 +0000)
committeroliskoli <oliskoli>
Tue, 20 Feb 2007 21:02:10 +0000 (21:02 +0000)
queue.c
waypt.c

diff --git a/queue.c b/queue.c
index 1c0b54d6593e1e97d984e80dd0d1b00b7d125716..3e81811598c155e602ed0b7d1e33c07c274d4b6a 100644 (file)
--- a/queue.c
+++ b/queue.c
@@ -39,6 +39,8 @@ dequeue(queue *element)
 
        next->prev = prev;
        prev->next = next;
+       
+       QUEUE_INIT(element);
        return element;
 }
 
diff --git a/waypt.c b/waypt.c
index 57985ed228da28b07e4443e4a490e5ebd736edce..f58179c776684a74ac858b19e363f126f70b2d5d 100644 (file)
--- a/waypt.c
+++ b/waypt.c
@@ -75,7 +75,7 @@ waypt_dupe(const waypoint *wpt)
         * It's important that this duplicated waypoint not appear
         * on the master Q.
         */
-       tmp->Q.next = tmp->Q.prev = NULL;
+       QUEUE_INIT(&tmp->Q);
        tmp->fs = fs_chain_copy( wpt->fs );
 
        return tmp;
@@ -145,6 +145,7 @@ waypt_new(void)
        wpt->fix = fix_unknown;
        wpt->sat = -1;
 
+       QUEUE_INIT(&wpt->Q);
        return wpt;
 }